package com.example.web_flux.config;

import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
import org.springframework.web.servlet.view.document.AbstractPdfView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @auth 罗俊华
 * @Date 2022/8/14 10:56 上午
 */

public class PdfWordList extends AbstractPdfView {


    @Override
    protected void buildPdfDocument(Map<String, Object> model, Document doc, PdfWriter writer, HttpServletRequest request, HttpServletResponse response) throws Exception {
        List<String> words = Arrays.asList("hello", "world");
        for (String word : words) {

            doc.add(new Paragraph(word));
        }
    }
}
